import Vue from "vue";
//引入vue-router路由插件
import Router from "vue-router";
import HomeIndex from "@/pages/Home/HomeIndex";

Vue.use(Router);

export default new Router({
  mode: "history",
  routes: [
    {
      path: "/",

      component: () => import("@/pages/Home"),
      redirect: "/home",
      children: [
        {
          path: "/home",

          name: "home",
          component: HomeIndex,
        },
        {
          path: "/product/:id",

          name: "Product",
          component: () => import("@/pages/Product"),
        },
        {
          path: "/detail/:id",
          name: "detail",
          component: () => import("@/pages/Detail"),
        },
      ],
    },

    {
      path: "/login",
      name: "login",
      component: () => import("@/pages/Login"),
    },
    {
      path: "/cart",
      name: "cart",
      component: () => import("@/pages/ShopCart"),
    },
    {
      path: "/order",
      name: "Order",
      component: () => import("@/pages/Order"),
      children: [
        {
          // path=="/order/list"
          path: "list",
          name: "orderlist",
          component: () => import("@/pages/Order/OrderList"),
        },
        {
          // path=="/order/confirm"
          path: "confirm",
          name: "orderconfirm",
          component: () => import("@/pages/Order/OrderConfirm"),
        },
        {
          path: "pay",
          name: "orderpay",
          component: () => import("@/pages/Order/OrderPay"),
        },
        {
          path: "alipay",
          name: "alipay",
          component: () => import("@/pages/Order/alipay"),
        },
      ],
    },
  ],
});
